#!/usr/bin/env bash
# 卸载docker
yum remove -y docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-selinux \
    docker-engine-selinux \
    docker-engine \
    docker-ce-cli.*

# yum-utils 是管理扩展包，用于发现 docker
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

# 安装并启动 docker 相关组件
yum install -y docker-ce-18.09.7 docker-ce-cli-18.09.7 containerd.io
# 设置 docker 开机启动
systemctl enable docker
# 启动 docker 服务
systemctl start docker